/*
//File Kernel_23/points_and_segment.cpp

#include <iostream>
#include <CGAL/Simple_cartesian.h>

typedef double NumberType;
typedef CGAL::Simple_cartesian<NumberType> Kernel;
typedef Kernel::Point_2 Point_2;
typedef Kernel::Segment_2 Segment_2;

int main()
{
	Point_2 p(1, 1), q(10, 10);
	std::cout << "p = " << p << std::endl;
	std::cout << "q = " << q.x() << " " << q.y() << std::endl;
	std::cout << "sqdist(p,q) = "
		<< CGAL::squared_distance(p, q) << std::endl;

	Segment_2 s(p, q);
	Point_2 m(5, 9);

	std::cout << "m = " << m << std::endl;
	std::cout << "sqdist(Segment_2(p,q), m) = "
		<< CGAL::squared_distance(s, m) << std::endl;
	std::cout << "p, q, and m ";
	switch (CGAL::orientation(p, q, m)) {
	case CGAL::COLLINEAR:
		std::cout << "are collinear\n";
		break;
	case CGAL::LEFT_TURN:
		std::cout << "make a left turn\n";
		break;
	case CGAL::RIGHT_TURN:
		std::cout << "make a right turn\n";
		break;
	}
	std::cout << " midpoint(p,q) = " << CGAL::midpoint(p, q) << std::endl;
	return 0;
}
//*/


//To do geometry with floating point numbers can be surprising as the next example shows.

/*
// File Kernel_23/surprising.cpp

#include <iostream>
#include <CGAL/Simple_cartesian.h>

typedef double NumberType;
typedef CGAL::Simple_cartesian<NumberType> Kernel;
typedef Kernel::Point_2 Point_2;

int main()
{
	{
		Point_2 p(0, 0.3), q(1, 0.6), r(2, 0.9);
		std::cout << (CGAL::collinear(p, q, r) ? "collinear\n" : "not collinear\n");
	}
	{
		Point_2 p(0, 1.0 / 3.0), q(1, 2.0 / 3.0), r(2, 1);
		std::cout << (CGAL::collinear(p, q, r) ? "collinear\n" : "not collinear\n");
	}
	{
		Point_2 p(0, 0), q(1, 1), r(2, 2);
		std::cout << (CGAL::collinear(p, q, r) ? "collinear\n" : "not collinear\n");
	}
	return 0;
}
//*/

/*
// File Kernel_23/exact.cpp
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <sstream>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;

int main()
{
	Point_2 p(0, 0.3), q, r(2, 0.9);
	{
		q = Point_2(1, 0.6);
		std::cout << (CGAL::collinear(p, q, r) ? "collinear\n" : "not collinear\n");
	}

	{
		std::istringstream input("0 0.3 1 0.6 2 0.9");
		input >> p >> q >> r;
		std::cout << (CGAL::collinear(p, q, r) ? "collinear\n" : "not collinear\n");
	}

	{
		q = CGAL::midpoint(p, r);
		std::cout << (CGAL::collinear(p, q, r) ? "collinear\n" : "not collinear\n");
	}

	return 0;
}
//*/

/*
//File Convex_hull_2/array_convex_hull_2.cpp
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/convex_hull_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;

int main()
{
	Point_2 points[5] = { Point_2(0,0), Point_2(10,0), Point_2(10,10), Point_2(6,5), Point_2(4,1) };
	Point_2 result[5];
	Point_2 *ptr = CGAL::convex_hull_2(points, points + 5, result);
	std::cout << ptr - result << " points on the convex hull:" << std::endl;
	for (int i = 0; i < ptr - result; i++) {
		std::cout << result[i] << std::endl;
	}
	return 0;
}
//*/

/*
//File Convex_hull_2/vector_convex_hull_2.cpp
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/convex_hull_2.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;
typedef std::vector<Point_2> Points;

int main()
{
	Points points, result;
	points.push_back(Point_2(0, 0));
	points.push_back(Point_2(10, 0));
	points.push_back(Point_2(10, 10));
	points.push_back(Point_2(6, 5));
	points.push_back(Point_2(4, 1));
	CGAL::convex_hull_2(points.begin(), points.end(), std::back_inserter(result));
	std::cout << result.size() << " points on the convex hull" << std::endl;
	return 0;
}
//*/


/*

//File Convex_hull_2/convex_hull_yz.cpp
#include <iostream>
#include <iterator>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Projection_traits_yz_3.h>
#include <CGAL/convex_hull_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K3;
typedef CGAL::Projection_traits_yz_3<K3> K;
typedef K::Point_2 Point_2;
int main()
{
	std::istream_iterator< Point_2 >  input_begin(std::cin);
	std::istream_iterator< Point_2 >  input_end;
	std::ostream_iterator< Point_2 >  output(std::cout, "\n");
	CGAL::convex_hull_2(input_begin, input_end, output, K());
	return 0;
}
//*/

//*
//3.1 Points and Vectors
#include <CGAL/Cartesian.h>
#include <CGAL/Origin.h>

typedef double NumberType;
typedef CGAL::Cartesian<NumberType> Kernel;
typedef Kernel::Point_2 Point_2;
typedef Kernel::Vector_2 Vector_2;

void main()
{
	Point_2 p(1.0, 1.0), q;
	Vector_2 v;
	v = p - CGAL::ORIGIN;
	q = CGAL::ORIGIN + v;
	q = p + (q - p) / 2.0;
}
//*/